<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>订单管理</title>
    <%--		静态包含base标签，css样式，jQuery文件--%>
    <%@ include file="/pages/common/head.jsp" %>
    <script type="text/javascript">

        $(function () {
            //给一键发货绑定单击事件
            $("#sendOrder").click(function () {
                return confirm("你确定要一键发货吗?");
            });

        });

    </script>
</head>
<body>

<div id="header">
    <img class="logo_img" alt="" src="../../static/img/logo.gif">
    <span class="wel_word">订单管理系统</span>
    <%@include file="/pages/common/manager_menu.jsp" %>

</div>

<div id="main">
    <form action="orderServlet" method="post">
        <table>
            <tr>
                <td>日期</td>
                <td>金额</td>
                <td>状态</td>
                <td>详情</td>
                <td>发货操作</td>
                <td colspan="2"></td>
            </tr>
            <c:forEach items="${requestScope.orders}" var="order">
                <tr>
                    <td>${order.createTime}</td>
                    <td>${order.price}</td>
                    <c:if test="${order.status ==0}">
                        <input type="hidden" name="orderId" value="${order.orderId}">
                        <td>未发货</td>
                    </c:if>
                    <c:if test="${order.status ==1}">
                        <td>已发货</td>
                    </c:if>
                    <c:if test="${order.status ==2}">
                        <td>已签收</td>
                    </c:if>

                    <td><a href="orderServlet">查看详情</a></td>
                        <%--                只有状态是未发货状态时才能点击发货按钮--%>
                    <c:if test="${order.status ==0}">
                        <%--                    提供数据给orderServlet使用--%>

                        <td><a href="orderServlet?action=sendOrder&orderId=${order.orderId}" id="sendOrder">点击发货</a>
                        </td>
                    </c:if>
                    <c:if test="${order.status ==1}">
                        <td>已发货</td>
                    </c:if>
                    <c:if test="${order.status ==2}">
                        <td>已签收</td>
                    </c:if>
                    <td><a href="#">删除</a></td>
                    <td><a href="#">编辑</a></td>
                </tr>
            </c:forEach>
        </table>
    </form>
</div>

<%@ include file="/pages/common/foot.jsp" %>
</body>
</html>